import { NextApiRequest, NextApiResponse } from "next";

export default async function handler(req: NextApiRequest, res: NextApiResponse) {
    // 设置 CORS 头部
    res.setHeader('Access-Control-Allow-Origin', '*'); // 允许所有来源

    if (req.method !== "POST") {
        console.log(`请求方法是是${req.method}`);
        res.send(`请求方法是是${req.method}`);

    }
    const email = req.body.email;
    console.log(`这里是后端我的邮箱是${email}`);

    res.status(200).json({
        id: 1,
        name: "John Doe",
        email: email
    });
}

